<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>菜单管理</title>
        <div th:replace="/common/system_form_header" ></div>
        <script type="text/javascript">
            $(function () {
                $("#parentId").combobox({
                    url:"/system/menu/comboxjson",
                    valueField:"id",
                    textField:"menuName",
                    required:true,
                    missingMessage:"请选择!"
                })
            });
        </script>
    </head>
    <body style="padding: 10px">
        <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
            <table class="form-table">
                <tr>
                    <td>所属父级</td>
                    <td>
                        <input name="parentId" id="parentId" class="easyui-combotree" />
                    </td>
                </tr>
                <tr>
                    <td width="90">菜单名称</td>
                    <td>
                        <input name="menuName" id="menuName" data-options="required:true,missingMessage:'请填写名称！'" class="easyui-validatebox textbox w-middle-more"/></td>
                </tr>
                <tr>
                    <td>访问地址</td>
                    <td><input name="menuUrl" id="menuUrl" data-options="required:true,missingMessage:'请填写地址！'" class="easyui-validatebox textbox w-middle-more"/></td>
                </tr>
                <tr>
                    <td>icon</td>
                    <td><input name="icon" id="icon" class="easyui-validatebox textbox w-middle-more"/></td>
                </tr>
                <tr>
                    <td>是否显示</td>
                    <td>
                        <input type="radio" name="showState" value="1" class="easyui-radiobutton" >是
                        <input type="radio" name="showState" value="0" class="easyui-radiobutton">否
                    </td>
                </tr>
            </table>
            <div class="form-table-button">
                <button onclick="submitForm()" class="easyui-linkbutton l-btn l-btn-small primary" type="button"> 保存 </button>
                <button onclick="closeWindow()" class="easyui-linkbutton l-btn l-btn-small default" type="button"> 关闭 </button>
            </div>
        </form>
        <script>
            function submitForm(){
                $('#ff').form('submit',{
                    url:"/system/menu/save",
                    onSubmit:function(){
                        return $(this).form('enableValidation').form('validate');
                    },
                    success:function(data){
                        var data = eval('(' + data + ')');
                        window.parent.$('#searchTable').treegrid('reload');
                        window.parent.$('#win').window('close');
                        showMessage(window.parent,data.msg);
                    }
                });
            }
        </script>
    </body>
</html>